﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Extensil.Processor;
using Extensil.Common;
using System.ComponentModel;
using TaskAutomation;

namespace Extensil.Console
{
    class Program
    {
        static TaskReader tr = new TaskReader();
        static void Main(string[] args)
        {
            StartAllTask();
        }
        private static void StartAllTask()
        {
            for(int i = 0; i < tr.Count; i++)
            {
                TaskBase task = tr.Get(i);
                int prg = (i * 100) / tr.Count;
                System.Console.Write("\r\n" + "Executing task '" + task.Name + "'.");
                task.Execute(TaskWorker_Event);
                System.Console.Write("\r\n" + "Task '" + task.Name + "' completed.\r\n");
            }
            System.Console.WriteLine("\r\n" + "All task completed successfully.");
            System.Console.ReadLine();
        }
        private static void TaskWorker_Event(object sender, ProgressChangedEventArgs e)
        {
            System.Console.Write("\r\n" + e.UserState.ToString());
        }
    }
}
